FROM centos:centos7.4.1708
LABEL maintainer="Patrick <patrick@qq.com>"

RUN yum install -y openssh-server tar wget curl rsync bzip2 net-tools lsof  gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel ntpdate
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_ecdsa_key -N ''
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_ed25519_key -N ''

RUN echo "root:123456" | chpasswd
RUN echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
RUN echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
RUN yum clean all
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
RUN ntpdate ntp.ntsc.ac.cn
RUN mkdir /var/run/sshd    

EXPOSE 22    
 
CMD ["/usr/sbin/sshd", "-D"]
